<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc.jsp"></jsp:include>
		
		<meta http-equiv="X-UA-Compatible" content="edge" />
		<title>收款结算-查看</title>
		<style>
		 ul,li{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
       /* .controlSize{

            min-height:100px;
            _height:100px;
            padding:0;
        }*/
        .payInformartion{
			width:1100px;
            height:40px;
            padding-left:0px;
            margin:0px;
            
        }
        .payInformartion li{
           padding-left: 15px;
         
            height:40px;
            line-height: 40px;
            font-size: 14px;
            
        } 
      #tb{
      
       	margin-top:10px;
      
        }
   		#tb table{
   			border:1px solid #95B8E7;
   			border-collapse:collapse;
   		}
   		#tb table thead th{
   		    border:1px solid #dbdbdb;
   			text-align:center;
   			width:300px;
   			font-size:12px;
   			/*color:#95B8E7;*/
   			height:30px;
   		   font-weight: normal;
   		   background: linear-gradient(to bottom,#F9F9F9 0,#efefef 100%);
   		   background: -webkit-linear-gradient(top,#F9F9F9 0,#efefef 100%);
           background: -moz-linear-gradient(top,#F9F9F9 0,#efefef 100%);
           background: -o-linear-gradient(top,#F9F9F9 0,#efefef 100%);
   		}
   		#tb table td{
   			border:1px solid #dbdbdb;
   			text-align:center;
   			width:300px;
   			font-size:12px;
   			height:30px;
   			
   		}
   		
		</style>
		<script type="text/javascript">
		var dataGridData = {total:0, rows:[]};
		var payDataGrid;
		var payMoney="";
		function fillDataGrid(){
		
		$.ajax({
			type:"get",
			url:"${ctx}/pltmPayment/paymentDetail?id=${requestScope.id}&temp="+Math.random(),
			dataType:'json',
			async:false,
			success:function(data){
				a=data;
				dataGridData.total = data.paymentDetails.length;
				dataGridData.rows = data.paymentDetails;
				$("#pssorderNumber").text(CommonConverter.toEmptyString(data.payNo));
				$("#payAccount").text(CommonConverter.toEmptyString(data.payAccount));
				$("#payName").text(CommonConverter.toEmptyString(data.payName));
				$("#payMoney").text(CommonConverter.toEmptyString(data.payMoney));
				$("#beizhu").text(CommonConverter.toEmptyString(data.auditRemarks));
				payMoney = data.payMoney;
			}
		});
	}
		
		$(function(){
			
			fillDataGrid();
			//console.log(dataGridData);
			
			payDataGrid=$("#payMent").datagrid({
				data:dataGridData,
				
				striped : true,
			   // fit : true,
			   // fitColumns: true,
			    singleSelect : true,
			    method : 'get',
			    showFooter: true,
			    columns:[ [ /*{
			        width : '100',
			        title : 'id',
			        align : 'center',
			        field : 'id',
			        hidden:true
			    },*/{
			        width : '160',
			        title : '平台单号',
			        align : 'center',
			        field : 'orderNumber'
			    },{
			     width : '160',
			     title : '供应商单号',
			     align : 'center',
			     field : 'pssOrderNumber'
			     },{
			        width : '120',
			        title : '供应商/采购商',
			        align : 'center',
			        field : 'act_pay',
			        formatter: function(value,row){
			        	if(row.orderNumber!="总计"){
			        		 return "<span>卖："+row.saleOrganName+"</span>"+"<br/>"+"<span>买："+row.buyOrganName+"</span>";
			        	}
			        }
			    },{
			        width : '120',
			        title : '订单金额/人数',
			        align : 'center',
			        field : 'act_sum',
			        formatter:function(value,row){
			        	if(row.orderNumber!="总计"){
			           	 	return "￥"+CommonConverter.toEmptyString(row.payPrice)+"/"+CommonConverter.toEmptyString(row.purchQuantity)+"人";
			        	}
			        }
			    },{
			        width : '120',
			        title : '支付金额',
			        align : 'center',
			        field : 'payMoney'
			    },{
			        width : '150',
			        title : '支付日期',
			        align : 'center',
			        field : 'payTime'
			    },{
			        width : '100',
			        title : '订单状态',
			        align : 'center',
			        field : 'orderStatus',
			        formatter: function(value,row){
			        	if(row.orderNumber!="总计"){
			        		switch(row.orderStatus+""){
				                case "0":
				                    return "待支付";
				                    break;
				                case "1":
				                    return "待审核";
				                    break;
				                case "2":
				                    return "待出票";
				                    break;
				                case "3":
				                    return "出票中";
				                    break;
				                case "4":
				                    return "出票成功";
				                    break;
				                case "5":
				                    return "取消";
				                    break;
				            }
			        	}
			        }
			    },{
			        width : '100',
			        title : '财务状态',
			        align : 'center',
			        field : 'financeStatus',
			        formatter: function(value,row){
			        	if(row.orderNumber!="总计"){
			        		var str=CommonConverter.toOrderPayStatusStr(row.financeStatus);
			            	return str;
			        	}
			        }
			    },{
			        width : '100',
			        title : '备注',
			        align : 'center',
			        field : 'orderRemark'
			       
			        }
			        
			    ] ]
			    
			});
			$('#payMent').datagrid('reloadFooter',[{orderNumber: '总计', payMoney: payMoney}]);
		})
		</script>
	</head>
	<body style="padding:5px;">
	<div>
    <ul class="payInformartion">
        <li>支付单号:<span id="pssorderNumber"></span></li>
    </ul>
          <table id="payMent"></table>
	</div>	
  
	<div id="tb">
         <table>
         	<thead>
        	<tr>
        		<th>账号</td>
        		<th>账户名称</td>
        		<th>线下支付</td>
        	</tr>
        	</thead>
        	<tbody>
        		<tr>
        		<td id="payAccount"></td>
        		<td id="payName"></td>
        		<td id="payMoney"></td>
        		</tr>
        	</tbody>
         </table>
     </div>  
     <div style="margin-top:5px;">
      <h3>备注：</h3><textarea id="beizhu" readonly rows="5" cols="150" style="border:1px solid #95B8E7;font-size:12px;"></textarea>
     </div>
	</body>
</html>